import 'package:flutter/material.dart';

/// Copyright (C), 2021-2024, Franky Lee
/// @ProjectName: text_generation_video
/// @Package: widgets.slider
/// @ClassName: circle_slider_thumb
/// @Description: 滑块样式
/// @Author: frankylee
/// @CreateDate: 2024/4/10 17:07
/// @UpdateUser: frankylee
/// @UpdateData: 2024/4/10 17:07
/// @UpdateRemark: 更新说明

class CircleSliderThumb extends SliderComponentShape {
  final double thumbRadius;

  const CircleSliderThumb({
    required this.thumbRadius,
  });

  @override
  Size getPreferredSize(bool isEnabled, bool isDiscrete) {
    return Size.fromRadius(thumbRadius);
  }

  @override
  void paint(
    PaintingContext context,
    Offset center, {
    required Animation<double> activationAnimation,
    required Animation<double> enableAnimation,
    required bool isDiscrete,
    required TextPainter labelPainter,
    required RenderBox parentBox,
    required SliderThemeData sliderTheme,
    required TextDirection textDirection,
    required double value,
    required double textScaleFactor,
    required Size sizeWithOverflow,
  }) {
    final Canvas canvas = context.canvas;

    // final paint = Paint()
    //   ..color = const Color(0xFF000000)
    //   ..style = PaintingStyle.stroke
    //   ..strokeWidth = 0.6;
    // canvas.drawCircle(center, thumbRadius, paint);

    final paint1 = Paint()
      ..color = Colors.white
      ..style = PaintingStyle.fill;
    canvas.drawCircle(center, thumbRadius - 0.6, paint1);

    // final paint2 = Paint()
    //   ..color = const Color(0xFF1C63F2)
    //   ..style = PaintingStyle.fill;
    // canvas.drawCircle(center, thumbRadius - 3.6, paint2);
  }
}
